    <?php
App::uses('AppModel', 'Model');

class Incidencia extends AppModel {
     
	 public $name = 'Incidencia';
	 
	  	public $belongsTo = array(
		'Casoreportado' => array(
			'className' => 'Casoreportado',
			'foreignKey' => 'casoreportado_id'
			
		),
	
		'Insteducativa' => array(
			'className' => 'Insteducativa',
			'foreignKey' => 'insteducativa_id'
			
		)
		
		
		);
		
		
	// JW - Behavior initiated from plugin. 
	public $actsAs = array(
		'Search.Searchable');

	// JW - Search fields data description for processing.
	public $filterArgs = array(
		array('name' => 'victima', 'type' => 'query', 'method' => 'filterVictima'),
		
	);
	
		
		public function filterVictima($data, $field = null) {
		if (empty($data['victima'])) {
			return array();
		}
		$victima = '%' . $data['victima'] . '%';
		return array(
			'OR'  => array(
				$this->alias . '.victima LIKE' => $victima,
				
			));
	}
	
	 }